<template>
    <div style="width: 100%">
        <!--  头部搜索和创建按钮区域-->
        <el-row :gutter="50">
            <!--    搜索区域列-->
            <el-col :span="8">
                <el-input
                    :disabled="!isSearchType"
                    v-model="queryInfo.keyWord"
                    suffix-icon="el-icon-search"
                    class="input-with-select"
                    clearable
                    @clear="getPostData"
                    @focus="setPageNum"
                    @input="getPostData"
                    placeholder="请输入搜索内容"
                >
                    <el-select
                        v-model="queryInfo.queryType"
                        slot="prepend"
                        placeholder="搜索类型"
                        id="post-query"
                    >
                        <el-option
                            label="暂无搜索"
                            value="noSearch"
                        />
                        <el-option
                            label="岗位名称"
                            value="postName"
                        />
                        <el-option
                            label="企业名称"
                            value="entName"
                        />
                    </el-select>
                </el-input>
            </el-col>
            <!--    按钮区域列-->
            <el-col :span="4">
                <el-row>
                    <el-tooltip
                        effect="dark"
                        content="创建岗位(学生可以绑定)"
                        v-if = "!isDisable"
                        placement="top"
                    >
                        <el-button
                            type="primary"
                            icon="el-icon-plus"
                            :disabled="isDisable"
                            circle
                            @click="addPostDialogVisible = true"
                        />
                    </el-tooltip>
                </el-row>
            </el-col>
        </el-row>
        <!--  表格数据区域-->
        <el-table
            :data="tableData"
            border
            highlight-current-row
            stripe
            style="width: 100%"
            :row-style="rowStyle"
            :cell-style="cellStyle"
        >
            <el-table-column
                :key="table.prop"
                v-for="table in tableHeader"
                :label="table.label"
                :prop="table.prop"
                align="center"
                :width="table.width"
            />
            <el-table-column
                label="操作"
                align="center"
                width="280px"
                fixed="right"
            >
                <!--        操作按钮区域的作用域插槽-->
                <template slot-scope="scope">
                    <el-tooltip
                        effect="dark"
                        content="查看企业(可查看本岗位所对应的企业)"
                        placement="top"
                    >
                        <el-button
                            type="info"
                            icon="el-icon-view"
                            circle
                            @click="toEnterpriseDataShow(scope.row.entName)"
                        />
                    </el-tooltip>
                    <el-tooltip
                        effect="dark"
                        content="投递简历"
                        v-if="stu"
                        placement="top"
                    >
                        <el-button
                            type="primary"
                            icon="el-icon-s-promotion"
                            circle
                            @click="sendResume(scope.row.postId)"
                        />
                    </el-tooltip>

                    <el-tooltip
                        effect="dark"
                        content="在线留言"
                        placement="top"
                    >
                        <el-button
                            type="primary"
                            icon="el-icon-s-comment"
                            circle
                            @click="sendComment(scope.row)"
                        />
                    </el-tooltip>


                    <el-tooltip
                        effect="dark"
                        content="立即沟通"
                        v-if="stu"
                        placement="top"
                    >
                        <el-button
                            type="primary"
                            icon="el-icon-phone"
                            circle
                            @click="sendChatMsg(scope.row)"
                        />
                    </el-tooltip>

                    <el-tooltip
                        effect="dark"
                        content="查看简历"
                        v-if="!stu"
                        placement="top"
                    >
                        <el-button
                            type="primary"
                            icon="el-icon-s-order"
                            circle
                            @click="getResume(scope.row.postId)"
                        />
                    </el-tooltip>

                    <el-tooltip
                        effect="dark"
                        content="编辑岗位(可编辑岗位信息)"
                        v-if = "!isDisable"
                        placement="top"
                    >
                        <el-button
                            type="primary"
                            icon="el-icon-edit"
                            :disabled="!(userEndId === scope.row.entId) && !ent"
                            circle
                            @click="editPostDialogVisible1(scope.row)"
                        />
                    </el-tooltip>
                    <el-tooltip
                        effect="dark"
                        content="删除岗位(只会删除学生岗位绑定信息)"
                        v-if = "!isDisable"
                        placement="top"
                    >
                        <el-button
                            type="danger"
                            icon="el-icon-delete"
                            :disabled="!(userEndId === scope.row.entId) && !ent"
                            circle
                            @click="deletePostDialogVisible1(scope.row.postId)"
                        />
                    </el-tooltip>
                </template>
            </el-table-column>
        </el-table>
        <!--    分页器区域-->
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="page.current"
            :page-sizes="[10, 20, 35, 50]"
            :page-size="page.limit"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page.total"
            background
        />
        <!--    添加岗位对话框区域-->
        <el-dialog
            title="添加岗位"
            :visible.sync="addPostDialogVisible"
            width="50%"
            :close-on-click-modal="false"
        >
            <el-form
                v-if="addPostDialogVisible"
                :model="addPostForm"
                :rules="addPostFormRules"
                ref="addPostFormRef"
                label-width="100px"
            >
                <el-form-item
                    label="岗位名称"
                    prop="postName"
                >
                    <el-input v-model="addPostForm.postName"/>
                </el-form-item>
                <el-form-item
                    label="招聘人数"
                    prop="peopleNumber"
                >
                    <el-input
                        v-model="addPostForm.peopleNumber"
                    />
                </el-form-item>
                <el-form-item
                    label="绑定专业"
                    prop="proId"
                >
                    <el-select
                        v-model="addPostForm.proId"
                        filterable
                        placeholder="试试搜索吧~">
                        <el-option-group
                            v-for="group in proOptions"
                            :key="group.professionalTypeName"
                            :label="group.professionalTypeName">
                            <el-option
                                v-for="item in group.professions"
                                :key="item.proName"
                                :label="item.proName"
                                :value="item.proId">
                            </el-option>
                        </el-option-group>
                    </el-select>
                </el-form-item>
                <el-form-item
                    label="工作地点"
                    prop="workAddress"
                >
                    <el-cascader
                        placeholder="试试搜索城市名称吧~"
                        v-model="postAddressTemp"
                        :options="postAddressCascaderOptions"
                        :props="{ expandTrigger: 'hover' }"
                        filterable

                    />
                </el-form-item>
                <el-form-item
                    label="工资待遇"
                    prop="money"
                >
                    <el-input v-model="addPostForm.money"/>
                </el-form-item>
                <el-form-item
                    label="绑定企业"
                    prop="entId"
                >
                    <el-select v-model="addPostForm.entId" filterable placeholder="试试搜索企业名称吧~">
                        <el-option
                            v-for="item in options"
                            :key="item.entName"
                            :label="item.entName"
                            :value="item.entId">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item
                    label="岗位介绍"
                    prop="postIntroduction"
                >
                    <el-input
                    type="textarea"
                    v-model="addPostForm.postIntroduction"/>
                </el-form-item>
            </el-form>
            <span
                slot="footer"
                class="dialog-footer"
            >
        <el-button @click="addPostDialogVisible = false">取 消</el-button>
        <el-button
            type="primary"
            @click="addPost"
        >添加岗位</el-button>
      </span>
        </el-dialog>

        <!--    编辑岗位对话框区域-->
        <el-dialog
            title="编辑岗位"
            :visible.sync="editPostDialogVisible"
            width="50%"
            :close-on-click-modal="false"
        >
            <el-form
                v-if="editPostDialogVisible"
                :model="editPostForm"
                :rules="editPostFormRules"
                ref="editPostFormRef"
                label-width="100px"
            >
                <el-form-item
                    label="岗位名称"
                    prop="postName"
                >
                    <el-input v-model="editPostForm.postName"/>
                </el-form-item>
                <el-form-item
                    label="招聘人数"
                    prop="peopleNumber"
                >
                    <el-input
                        v-model="editPostForm.peopleNumber"
                    />
                </el-form-item>
                <el-form-item
                    label="绑定专业"
                    prop="proId"
                >
                    <el-select
                        v-model="editPostForm.proId"
                        filterable
                        placeholder="试试搜索吧~">
                        <el-option-group
                            v-for="group in proOptions"
                            :key="group.professionalTypeName"
                            :label="group.professionalTypeName">
                            <el-option
                                v-for="item in group.professions"
                                :key="item.proName"
                                :label="item.proName"
                                :value="item.proId">
                            </el-option>
                        </el-option-group>
                    </el-select>
                </el-form-item>
                <el-form-item
                    label="工作地点"
                    prop="workAddress"
                >
                    <el-cascader
                        placeholder="试试搜索城市名称吧~"
                        v-model="companyAddressTemp"
                        :options="postAddressCascaderOptions"
                        :props="{ expandTrigger: 'hover' }"
                        filterable
                    />
                </el-form-item>
                <el-form-item
                    label="工资待遇"
                    prop="money"
                >
                    <el-input v-model="editPostForm.money"/>
                </el-form-item>
                <el-form-item
                    label="绑定企业"
                    prop="entId"
                >
                <el-select v-model="editPostForm.entId" filterable placeholder="试试搜索企业名称吧~">
                    <el-option
                        v-for="item in options"
                        :key="item.entName"
                        :label="item.entName"
                        :value="item.entId">
                    </el-option>
                </el-select>
                </el-form-item>
                <el-form-item
                    label="岗位介绍"
                    prop="postIntroduction"
                >
                    <el-input
                        type="textarea"
                        v-model="editPostForm.postIntroduction"/>
                </el-form-item>
            </el-form>
            <span
                slot="footer"
                class="dialog-footer"
            >
        <el-button @click="editPostDialogVisible = false">取 消</el-button>
        <el-button
            type="primary"
            @click="editPost"
        >编辑岗位</el-button>
      </span>
        </el-dialog>

        <!--    删除岗位对话框-->
        <el-dialog
            title="删除岗位"
            :visible.sync="deletePostDialogVisible"
            width="50%"
            :close-on-click-modal="false"
        >
            <span>确认删除吗?</span>
            <span
                slot="footer"
                class="dialog-footer"
            >
        <el-button @click="deletePostDialogVisible = false">取 消</el-button>
        <el-button
            type="primary"
            @click="deletePost"
        >删除岗位</el-button>
      </span>
        </el-dialog>
    </div>
</template>

<script>
    // 导入省市数据及解释器
    import { provinceAndCityData, CodeToText } from 'element-china-area-data'

    export default {
        name: 'PostManage',
        data () {
            return {
                // 显示学生数据是否附带显示类型
                isSearchType: false,
                isDisable : false,
                stu:false,
                ent:false,
                // 工作地点联动菜单数据
                postAddressCascaderOptions: provinceAndCityData,
                enterpriseCascaderOptions: [],
                /** 公共的工作地址临时属性 */
                postAddressTemp: '',
                companyAddressTemp:'',
                /** 公共的绑定企业临时属性 */
                bindEnterpriseTemp: '',
                user: JSON.parse(window.sessionStorage.getItem('user')),
                page: {
                    current: 1,
                    limit: 10,
                    total: 0
                },
                /** 数据表格 */
                // 数据表格数据绑定
                queryInfo: {
                    // 当前搜索关键字
                    keyWord: '',
                    // 当前页数
                    // 当前搜索类型
                    queryType: 'noSearch'
                },
                // 数据表格数据
                tableData: [],
                // 总共多少条数据
                total: 0,
                tableHeader: [
                    { label: '岗位名称', prop: 'postName', width: 200 },
                    { label: '所属企业', prop: 'entName', width: 250 },
                    { label: '所属专业', prop: 'proName', width: 250 },
                    { label: '发布人', prop: 'usernameCn', width: 250 },
                    { label: '招聘人数', prop: 'peopleNumber' },
                    { label: '工作地点', prop: 'workAddress', width: 200 },
                    { label: '工资待遇', prop: 'money', width: 200 },
                    { label: '创建时间', prop: 'createTime', width: 280 }
                ],
                /** 控制添加岗位对话框的显示与隐藏 */
                addPostDialogVisible: false,
                /** 新增班级表单数据 */
                addPostForm: {
                    postName: '',
                    proId:'',
                    entId: '',
                    postIntroduction:'',
                    peopleNumber: '',
                    workAddress: '',
                    money: ''
                },
                /** 表单验证相关配置 */
                addPostFormRules: {
                    postName: [
                        { required: true, message: '请输入岗位名称', trigger: 'blur' },
                        { min: 3, max: 21, message: '长度在 3 到 21 个字符', trigger: 'blur' }
                    ],
                    peopleNumber: [
                        { min: 1, message: '长度在至少 1 个字符', trigger: 'blur' },
                        { required: true, message: '请输入招聘人数', trigger: 'blur' }],
                    workAddress: [
                        { required: true, message: '请选择专业类型', trigger: 'blur' }
                    ],
                    proId: [
                        { required: true, message: '请选择工作地点', trigger: 'blur' }
                    ],
                    money: [
                        { required: true, message: '请输入工资待遇', trigger: 'blur' },
                        {
                            type: 'string',
                            message: '工资格式不正确',
                            trigger: 'blur',
                            transform (value) {
                                if (!/^\d+$/.test(value)) {
                                    return true
                                } else {
                                }
                            }
                        },
                    ],
                    entId: [
                        { required: true, message: '请选择绑定企业', trigger: 'blur' }
                    ]
                },
                /** 控制编辑岗位对话框的显示与隐藏 */
                editPostDialogVisible: false,
                /** 编辑班级表单数据 */
                editPostForm: {
                    postId:'',
                    postName: '',
                    proId:'',
                    entId: '',
                    postIntroduction:'',
                    peopleNumber: '',
                    workAddress: '',
                    money: ''
                },
                /** 表单验证相关配置 */
                editPostFormRules: {
                    postName: [
                        { required: true, message: '请输入岗位名称', trigger: 'blur' },
                        { min: 3, max: 21, message: '长度在 3 到 21 个字符', trigger: 'blur' }
                    ],
                    peopleNumber: [
                        { min: 1, message: '长度在至少 1 个字符', trigger: 'blur' },
                        { required: true, message: '请输入招聘人数', trigger: 'blur' }],
                    workAddress: [
                        { required: true, message: '请选择工作地点', trigger: 'blur' }
                    ],
                    proId: [
                        { required: true, message: '请选择专业类型', trigger: 'blur' }
                    ],
                    money: [
                        { required: true, message: '请输入工资待遇', trigger: 'blur' },
                        {
                            type: 'string',
                            message: '工资格式不正确',
                            trigger: 'blur',
                            transform (value) {
                                if (!/^\d+$/.test(value)) {
                                    return true
                                } else {
                                }
                            }
                        }
                    ],
                    entId: [
                        { required: true, message: '请选择绑定企业', trigger: 'blur' }
                    ]
                },
                /** 控制删除岗位对话框的显示与隐藏 */
                deletePostDialogVisible: false,
                options:[],
                proOptions:[],
                deletePostId:'',
                userEndId:""
            }
        },
        watch: {
            // 城市代码数组转换为字符串
            postAddressTemp: function (val) {
                this.addPostForm.workAddress = CodeToText[val[0]] + '-' + CodeToText[val[1]]
            },
            // 当用户选择搜索学生的前置条件则锁定筛选数据类型为全部数据并禁用单选框否则应该清空输入框数据
            'queryInfo.queryType': function (val) {
                if (val !== 'noSearch') {
                    this.isSearchType = true
                } else {
                    this.isSearchType = false
                    this.queryInfo.keyWord = ''
                    this.getPostData()
                }
            },
            // 城市代码数组转换为字符串
            companyAddressTemp: function (val) {
                this.editForm.workAddress = CodeToText[val[0]] + '-' + CodeToText[val[1]]
            },
            // bindEnterpriseTemp: function (val) {
            //     this.editPostForm.bindEnterprise = val[0]
            // }
        },
        /** 生命周期函数 */
        created () {
            let user = this.user;
            this.getEntId();
            if (user.type == "2"){
                this.isDisable = true;
            }
            if (user.type === "0"){
                this.ent = true;
            }
            if (user.type === "2"){
                this.stu = true;
            }
            this.getEnterpriseDataCascaderOptions()
            this.getProfessionDataCascaderOptions()
            const entName = this.$route.query.entName
            if (entName !== undefined && entName !== '') {
                this.queryInfo.keyWord = entName
                this.queryInfo.queryType = 'entName'
            }
            this.getPostData()
        },
        /** 事件处理函数 */
        methods: {
            /** 获取企业数据 */
            getEnterpriseDataCascaderOptions () {
                let self = this
                self.utils.sendReq({
                    queryUrl: 'enterprise/getOptions',
                    req: {
                        method: 'get',
                        success: function (req) {
                            if (req.data.code === 200) {
                                self.options = req.data.data;
                            }
                        }
                    }
                })
            },

            /** 创建岗位 */
            addPost () {
                let self = this;
                let post = {};
                post.postName = self.addPostForm.postName
                post.entId = self.addPostForm.entId
                post.proId = self.addPostForm.proId;
                post.postIntroduction = self.addPostForm.postIntroduction
                post.peopleNumber = self.addPostForm.peopleNumber
                post.workAddress = self.addPostForm.workAddress
                post.money = self.addPostForm.money
                this.$refs.addPostFormRef.validate(async valid => {
                    if (valid) {
                        self.utils.sendReq({
                            queryUrl: '/post/add',
                            req: {
                                data:  post ,
                                method: 'post',
                                success: function (req) {
                                    if (req.data.code === 200) {
                                        self.$message({
                                            message: req.data.msg,
                                            type: 'success',
                                            showClose: true,
                                            center: true
                                        })
                                        self.getPostData()
                                        self.addPostDialogVisible = false
                                    }
                                    if (req.data.code === 400) {
                                        self.$message({
                                            message: req.data.msg,
                                            type: 'error',
                                            showClose: true,
                                            center: true
                                        })
                                    }
                                },
                                error: function () {
                                    self.$message({
                                        message: '接口请求失败！',
                                        type: 'error',
                                        showClose: true,
                                        center: true
                                    })
                                }
                            }
                        })
                    }
                })
            },

            editPostDialogVisible1 (postData) {
                for (const key in postData) {
                    this.editPostForm[key] = postData[key]
                }
                // 自动显示单位地址
                    const chinaAddress = this.postAddressCascaderOptions
                    const address = postData.workAddress.split('-')
                    const arr1 = []
                    for (let i = 0; i < chinaAddress.length; i++) {
                        // 获取省份
                        if (chinaAddress[i].label === address[0]) {
                            arr1.push(chinaAddress[i].value)
                            for (let ii = 0; ii < chinaAddress[i].children.length; ii++) {
                                // 获取市区等
                                if (chinaAddress[i].children[ii].label === address[1]) {
                                    arr1.push(chinaAddress[i].children[ii].value)
                                }
                            }
                        }
                    }
                    this.companyAddressTemp = arr1

                this.editPostDialogVisible = true
            },
            /** 编辑岗位 */
            editPost () {
                let self = this;
                let post = {};
                post.postId = self.editPostForm.postId
                post.postName = self.editPostForm.postName
                post.entId = self.editPostForm.entId
                post.proId = self.editPostForm.proId;
                post.postIntroduction = self.editPostForm.postIntroduction
                post.peopleNumber = self.editPostForm.peopleNumber
                post.workAddress = self.editPostForm.workAddress
                post.money = self.editPostForm.money
                this.$refs.editPostFormRef.validate(async valid => {
                    if (valid) {
                        this.utils.sendReq({
                            queryUrl: 'post/update',
                            req: {
                                data: post,
                                method: 'post',
                                success: function (req) {
                                    if (req.data.code === 200) {
                                        self.$message({
                                            message: req.data.msg,
                                            type: 'success',
                                            showClose: true,
                                            center: true
                                        })
                                        self.getPostData()
                                        self.editPostDialogVisible = false
                                    }
                                    if (req.data.code === 400) {
                                        self.$message({
                                            message: req.data.msg,
                                            type: 'error',
                                            showClose: true,
                                            center: true
                                        })
                                    }
                                },
                                error: function () {
                                    self.$message({
                                        message: '接口请求失败！',
                                        type: 'error',
                                        showClose: true,
                                        center: true
                                    })
                                }
                            }
                        })
                    }
                })
            },

            /** 删除岗位 */
            deletePostDialogVisible1 (postId) {
                this.deletePostDialogVisible = true
                this.deletePostId = postId
            },
            deletePost () {
                let self = this;
                let deletePostId = self.deletePostId;
                this.utils.sendReq({
                    queryUrl: `post/delete/${deletePostId}`,
                    req: {
                        method: 'get',
                        success: function (req) {
                            if (req.data.code === 200) {
                                self.$message({
                                    message: req.data.msg,
                                    type: 'success',
                                    showClose: true,
                                    center: true
                                })
                                self.deletePostDialogVisible = false
                                self.getPostData();
                            }
                            if (req.data.code === 400) {
                                self.$message({
                                    message: req.data.msg,
                                    type: 'error',
                                    showClose: true,
                                    center: true
                                })
                                self.deletePostDialogVisible = false
                            }
                        },
                        error: function () {
                            self.$message({
                                message: '接口请求失败！',
                                type: 'error',
                                showClose: true,
                                center: true
                            })
                            self.deletePostDialogVisible = false
                        }
                    }
                })
            },

            /** 获取岗位数据 */
            getPostData () {
                let self = this;
                let queryType = self.queryInfo.queryType;
                let entName = '';
                let postName = '';
                if (queryType === 'entName'){
                    entName = self.queryInfo.keyWord
                }
                if (queryType === 'postName'){
                    postName = self.queryInfo.keyWord
                }
                let current = self.page.current
                let limit = self.page.limit
                let postVos = []
                self.utils.sendReq({
                    queryUrl: '/post/query?current=' + current + '&limit=' + limit
                        + '&postName=' + postName + '&entName=' + entName,
                    req: {
                        method: 'get',
                        success: function (req) {
                            if (req.data.code === 200) {
                                self.page.total = req.data.data.page.rows
                                for (let i in req.data.data.postVos) {
                                    postVos.push(req.data.data.postVos[i])
                                }
                                self.tableData = postVos
                            }
                        }
                    }
                })

            },

            /** 跳转到企业数据页面并显示本岗位对应的企业 */
            toEnterpriseDataShow (entName) {
                this.$router.push({
                    path: '/admin/enterpriseManage',
                    query: {
                        entName: entName
                    }
                })
            },
            sendResume(postId){
                let self = this;
                self.utils.sendReq({
                    queryUrl:`/resume/send/${postId}`,
                    req:{
                        method:'get',
                        success: function (req) {
                            if (req.data.code === 200) {
                                self.$message({
                                    message: req.data.msg,
                                    type: 'success',
                                    showClose: true,
                                    center: true
                                })
                            }
                            if (req.data.code === 400) {
                                self.$message({
                                    message: req.data.msg,
                                    type: 'error',
                                    showClose: true,
                                    center: true
                                })
                                self.deletePostDialogVisible = false
                            }
                        },
                        error: function () {
                            self.$message({
                                message: '接口请求失败！',
                                type: 'error',
                                showClose: true,
                                center: true
                            })
                            self.deletePostDialogVisible = false
                        }
                    }
                })
            },
            getResume(postId){
                this.$router.push({
                    path: '/admin/resumeList',
                    query: {
                        postId : postId
                    }
                })
            },

            /** 修复当用户在大于1的分页进行数据搜索没有返回值的问题 */
            setPageNum () {
                this.page.current = 1
                this.getPostData()
            },
            /** 监听每页显示多少数据的改变 */
            handleSizeChange (newSize) {
                this.page.limit = newSize
                this.getPostData()
            },
            /** 监听页码的改变 */
            handleCurrentChange (newPage) {
                this.page.current = newPage
                this.getPostData()
            },
            rowStyle (row, rowIndex) {
                return 'height : 35px'
            },
            cellStyle () {
                return 'padding : 2px'
            },
            /** 获取专业数据 */
            getProfessionDataCascaderOptions () {
                let self = this
                self.utils.sendReq({
                    queryUrl: 'professionalType/queryAll',
                    req: {
                        method: 'get',
                        success: function (req) {
                            if (req.data.code === 200) {
                                self.proOptions = req.data.data;
                            }
                        }
                    }
                })
            },
            getEntId(){
                let self = this;
                self.utils.sendReq({
                    queryUrl:'/enterpriseUser/getEntId',
                    req:{
                        method:'get',
                        success:function (req) {
                            if (req.data.code == 200){
                                self.userEndId = req.data.data;
                            }
                        }
                    }
                })
            },
            sendChatMsg(data){
                let user={};
                user.username = data.username
                user.userNameCn = data.usernameCn
                this.$router.push({
                    path: '/admin/FriendChat',
                    query: {
                        user: JSON.stringify(user)
                    }
                })
            },
            sendComment(data){
                let post = {};
                post.postId = data.postId;
                post.postName = data.postName;
                post.money = data.money;
                post.entName = data.entName;
                this.$router.push({
                    path: '/admin/comment',
                    query: {
                        post : JSON.stringify(post)
                    }
                })
            }
        }
    }
</script>

<style lang="less" scoped>
    .el-table {
        align-items: center;
        margin-top: 25px;
    }

    .el-pagination {
        margin-top: 25px;
    }

    /deep/ #post-query {
        width: 120px !important;
    }
</style>
